package com.linq.cool.api.feign;

import com.linq.cool.api.domain.SysFile;
import com.linq.cool.api.factory.RemoteFileFallbackFactory;
import com.linq.cool.common.constants.ServiceNameConstants;
import com.linq.cool.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: yqlin
 * @Date: 2021/1/2 14:24
 * @Description: 文件服务
 * @Version: 1.0.0
 */
@FeignClient(contextId = "remoteileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
    /**
     * 上传文件
     *
     * @param file 文件信息
     *
     * @return 结果
     */
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Result<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
}
